package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.RevenueSettingService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;
import com.junzhiit.nengji.cms.web.vo.RevenueSettingVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/revenue/setting")
public class RevenueSettingController extends BaseController{

	@Autowired
	private RevenueSettingService revenueSettingService;
	
	@ApiOperation(value = "查询流水信息")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp,Integer type) {
		return revenueSettingService.findAll(dtp,type);
	}
	
	@ApiOperation(value = "新增流水信息")
	@RequestMapping(method = RequestMethod.POST)
	public ResultVO add(RevenueSettingVO revenueSettingVO) {
		return revenueSettingService.add(revenueSettingVO);
	}
	
	@ApiOperation(value = "根据ID查询提问")
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public ResultVO findById(@PathVariable String id) {
		AssertUtil.notBlank(id, "id is required.");
		return revenueSettingService.findById(id);
	}
	
	@ApiOperation(value = "修改流水")
	@RequestMapping(method = RequestMethod.PUT)
	public ResultVO update(RevenueSettingVO revenueSettingVO) {
		return revenueSettingService.edit(revenueSettingVO);
	}
	
	@ApiOperation(value = "删除流水")
	@RequestMapping(value = "/del", method = RequestMethod.PUT)
	public ResultVO delete(String id) {
		AssertUtil.notBlank(id, "id is required.");
		return revenueSettingService.delele(id);
	}
}
